package com.project.study.farming.base.controller;

import com.project.study.farming.base.entity.dto.UserDto;
import com.project.study.farming.base.service.UserSelfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 个人中心
 * @since 2020-05-11
 */
@Controller
@RequestMapping
public class UserSelfController {

    @Autowired
    private UserSelfService userSelfService;

    /**
     * 个人中心查看
     * @return 个人中心页面
     */
    @GetMapping("userCenterPage")
    public ModelAndView userCenterPage(){
        return this.userSelfService.userCenterPage();
    }

    /**
     * 个人中心编辑
     * @return 个人中心页面
     */
    @PostMapping("editUserCenter")
    public ModelAndView editUserCenter(UserDto user){
        return this.userSelfService.editUserCenter(user);
    }
}
